package io.gitee.tziye.core.msg;

import io.gitee.tziye.RenaiClient;
import io.vavr.Tuple2;

import java.util.Date;
import java.util.List;

public abstract class MsgOperator {

    protected final RenaiClient renaiClient;

    public MsgOperator(RenaiClient renaiClient) {
        this.renaiClient = renaiClient;
    }

    public abstract <T> void produce(String topic, String key, T value);

    public abstract <T> void produce(String topic, List<Tuple2<String, T>> msgs);

    public abstract List<RenaiMsg> consume(String topic, String group, int count, Date start);

    public abstract void ack(String topic, int pt, String group, long msgId);

    public abstract List<RenaiMsg> replay(String topic, Date startTime, Date endTime, int count, long curId);

    public abstract List<RenaiMsg> replay(String topic, long minId, long maxId, int count, long curId);

    public abstract int delete(String topic);

}
